#ifndef SCOREQUERYBYDATE_H
#define SCOREQUERYBYDATE_H

#include <QWidget>
#include <QDate>
#include <QDateEdit>
#include <QComboBox>
#include <QPushButton>
#include <QTableWidget>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QLabel>
#include <QCheckBox>
#include <QHeaderView>
#include <QList>
#include <QMessageBox>

class MainWindow;
class Database;

class ScoreQueryByDate : public QWidget
{
    Q_OBJECT

public:
    explicit ScoreQueryByDate(MainWindow *parent = nullptr);
    ~ScoreQueryByDate();

    void refreshData();

private slots:
    void onDateChanged(const QDate &date);
    void onUnitChanged(const QString &unit);
    void onQueryClicked();
    void onDeleteSelectedClicked();
    void onSelectAllToggled(bool checked);

private:
    MainWindow *mainWindow;
    Database *database;

    QDateEdit *dateEdit;
    QComboBox *unitSelect;
    QPushButton *queryButton;
    QPushButton *deleteSelectedButton;
    QCheckBox *selectAllCheck;
    QTableWidget *resultTable;

    QDate currentDate;
    QString currentUnit;

    void setupUi();
    void loadData();
    void loadUnits();
};

#endif // SCOREQUERYBYDATE_H